package fun.linze.wallpaperwebsite.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import fun.linze.wallpaperwebsite.domain.TTag;
import fun.linze.wallpaperwebsite.service.TTagService;
import fun.linze.wallpaperwebsite.mapper.TTagMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author wangy
* @description 针对表【t_tag(标签定义表)】的数据库操作Service实现
* @createDate 2025-06-27 18:02:42
*/
@Service
public class TTagServiceImpl extends ServiceImpl<TTagMapper, TTag>
    implements TTagService{

    @Override
    public List<String> getTagNameById(List<Integer> tagId) {
        //根据标签id获取对应的标签名称
        if (tagId != null && !tagId.isEmpty()) {
            return this.lambdaQuery()
                    .select(TTag::getName)
                    .in(TTag::getId, tagId)
                    .list()
                    .stream()
                    .map(TTag::getName)
                    .toList();
        }
        //如果标签id列表为空，返回空列表
        return List.of();
    }
}




